package cuit.campus.taskRunning.user.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonValue;

public enum TaskTypeEnum {
    PICKUP(0,"取送件"),
    PURCHASING(1,"代购"),
    UNDERTAKE(2,"待办事");
    @EnumValue  // 标记这个字段是存储到数据库的值

    private Integer num;
    @JsonValue  // 标记这个字段是序列化到前端的值
    private String work;

    TaskTypeEnum(Integer num,String work){
        this.num=num;
        this.work=work;
    }

    public Integer getNum()
    {
        return num;
    }
    public String getWork() {
        return work;
    }
    public static TaskTypeEnum getByNum(Integer num)
    {
        for(TaskTypeEnum status: values()){
            if(status.getNum().equals(num))
                return status;
        }
        return null;
    }
}
